home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 with MFC / Programming Windows 95 with MFC (Microsoft Programming Series)(097-0001465)(1996).iso / CODE / Chap11 / MyWord / MyWordDoc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-05  |  1.1 KB  |  41 lines

  1. //***********************************************************************
  2. //
  3. //  MyWordDoc.cpp
  4. //
  5. //***********************************************************************
  6.  
  7. #include <afxwin.h>
  8. #include <afxcmn.h>
  9. #include <afxrich.h>
  10. #include "Resource.h"
  11. #include "MyWordDoc.h"
  12.  
  13. IMPLEMENT_DYNCREATE (CWordDoc, CRichEditDoc)
  14.  
  15. BEGIN_MESSAGE_MAP (CWordDoc, CRichEditDoc)
  16.     ON_COMMAND (ID_FILE_SEND_MAIL, OnFileSendMail)
  17.     ON_UPDATE_COMMAND_UI (ID_FILE_SEND_MAIL, OnUpdateFileSendMail)
  18. END_MESSAGE_MAP ()
  19.  
  20. BOOL CWordDoc::OnNewDocument ()
  21. {
  22.     if (!CRichEditDoc::OnNewDocument ())
  23.         return FALSE;
  24.  
  25.     CHARFORMAT cf;
  26.     cf.cbSize = sizeof (CHARFORMAT);
  27.     cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE |
  28.         CFM_PROTECTED | CFM_STRIKEOUT | CFM_FACE | CFM_SIZE;
  29.     cf.dwEffects = 0;
  30.     cf.yHeight = 240; // 240 twips == 12 points
  31.     ::lstrcpy (cf.szFaceName, "Times New Roman");
  32.     GetView ()->SetCharFormat (cf);
  33.  
  34.     return TRUE;
  35. }
  36.  
  37. CRichEditCntrItem* CWordDoc::CreateClientItem (REOBJECT* preo) const
  38. {
  39.     return new CRichEditCntrItem (preo, (CWordDoc*) this);
  40. }
  41.